home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / src / oscillat.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  683 b   |  24 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is part of the Atari Machine Specific Library,
  4. //  and is Copyright 1992 by Warwick W. Allison.
  5. //
  6. //  You are free to copy and modify these sources, provided you acknowledge
  7. //  the origin by retaining this notice, and adhere to the conditions
  8. //  described in the file COPYING.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. #include "Oscillator.h"
  12. #include <bool.h>
  13.  
  14. Oscillator::Oscillator(int min,int max) :
  15.     Min(min), Max(max), Throb(Min), Way(-1)
  16. { }
  17.  
  18. int Oscillator::Oscillate()
  19. {
  20.     if (Throb==Min || Throb==Max) Way=-Way;
  21.  
  22.     return Throb+=Way;
  23. }
  24.